package com.chee.plant.server;

import org.apache.mina.common.IoSession;
import org.apache.mina.filter.codec.ProtocolEncoder;
import org.apache.mina.filter.codec.ProtocolEncoderOutput;

public class MessageEncoder implements ProtocolEncoder {
	@Override
	public void dispose(IoSession session) throws Exception {
		// nothing to dispose
	}
	@Override
	public void encode(IoSession session, Object message, ProtocolEncoderOutput out)
			throws Exception {
//		Message msg = (Message)message;
//        ByteBuffer buffer = ByteBuffer.allocate(msg.getTotalSize()+4, false);
//        buffer.putInt(msg.getTotalSize());
//        buffer.putInt(msg.getUserId());
//        buffer.putInt(msg.getCommand().ordinal());
//        buffer.putInt(msg.getResult());
//        buffer.putInt(msg.getFlag());
//        buffer.putInt(msg.getContentSize());
//		buffer.put(msg.getContent());
//		buffer.putLong(msg.getCRC());
//        buffer.flip();
//        out.write(buffer);
	}

}
